package com.command.center.pucms.pucmsgateway.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.command.center.pucms.pucmsgateway.domain.Role;
import com.command.platform.mybatis.mapper.IBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

/**
 * <p>
 * 角色信息表 Mapper 接口
 * </p>
 *
 * @author zlb
 * @since 2021-04-23
 */
@Mapper
public interface RoleMapper extends IBaseMapper<Role> {

    /**
     * 根据用户id获取其角色key列表
     *
     * @param userId userId
     * @return Set<Role>
     */
    Set<String> getRoleSet(@Param("userId") Integer userId);


    /**
     * 根据用户id获取其角色id列表
     *
     * @param userId userId
     * @return Set<Integer>
     */
    @Select("SELECT role_id FROM pucms_t_role_user WHERE user_id = #{userId}")
    Set<Integer> getRoleIdSet(Integer userId);


}
